//
//  TestInfoCell.m
//  掌上宏力
//
//  Created by admin on 2017/5/17.
//  Copyright © 2017年 admin. All rights reserved.
//

#import "TestInfoCell.h"
#import "TestInfoModel.h"

static CGFloat Lab_H = 30;

@interface TestInfoCell ()
/*
 \"TEST_NO\": \"1502076694\",
 
 \"RELEVANT_CLINIC_DIAG\": \"\", 诊断
 \"VERIFIED_BY\": \"张珂\",        报告者
 \"LAST_VISIT_DATE\": \"2015/11/1021: 37: 11\",
 \"ITEM_NAME\": \"免疫三项\",
 \"DEPT_NAME\": \"便民门诊\",
 \"DOCTORNAME\": \"葛相栓\"   开单医生
 },
 
 
 @property (nonatomic,copy) NSString *testNo;
 @property (nonatomic,copy) NSString *testName;
 @property (nonatomic,copy) NSString *testDate;
 @property (nonatomic,copy) NSString *testDept;
 @property (nonatomic,copy) NSString *testReporter;//报告人
 @property (nonatomic,copy) NSString *testDoctor;//开单医生
 @property (nonatomic,copy) NSString *testResult;//诊断
 
 */
@property (nonatomic,weak) UILabel *testNameLab;
@property (nonatomic,weak) UILabel *testDeptLab;
@property (nonatomic,weak) UILabel *testReportLab;
@property (nonatomic,weak) UILabel *testDoctorLab;
@property (nonatomic,weak) UILabel *testResultLab;

@end

@implementation TestInfoCell

- (void)awakeFromNib {
    [super awakeFromNib];
    // Initialization code
}

-(instancetype)initWithStyle:(UITableViewCellStyle)style reuseIdentifier:(NSString *)reuseIdentifier{
    if (self = [super initWithStyle:style reuseIdentifier:reuseIdentifier]) {
        UILabel *testNameLab = [[UILabel alloc] initWithFrame:CGRectMake(LeftDis, 5, kScreenW-20, Lab_H)];
        testNameLab.font = kFont(16);
        [self.contentView addSubview:testNameLab];
        self.testNameLab = testNameLab;
        
        UILabel *departLab = [[UILabel alloc] initWithFrame:CGRectMake(LeftDis, testNameLab.bottom, 200, Lab_H)];
        departLab.font = kFont(16);
        [self.contentView addSubview:departLab];
        self.testDeptLab = departLab;
    
        
        UILabel *doctorLab = [[UILabel alloc] initWithFrame:CGRectMake(kScreenW-180, testNameLab.bottom, 150, Lab_H)];
        doctorLab.font = kFont(14);
        [self.contentView addSubview:doctorLab];
        self.testDoctorLab = doctorLab;
        
        UILabel *testResultLab = [[UILabel alloc] init];
        testResultLab.font = kFont(14);
        [self.contentView addSubview:testResultLab];
        self.testResultLab = testResultLab;
        
    }
    return self;
}
-(void)setTestInfo:(TestInfoModel *)testInfo{
    self.testNameLab.text = testInfo.testName;
    self.testDeptLab.text = [NSString stringWithFormat:@"科室: %@",testInfo.testDept];

    self.testDoctorLab.text = [NSString stringWithFormat:@"开单医生: %@",testInfo.testDoctor];

    if (testInfo.testResult.length > 3) {
        self.testResultLab.frame = CGRectMake(LeftDis, 65, kScreenW-LeftDis*4, Lab_H);
        self.testResultLab.text = [NSString stringWithFormat:@"诊断：%@",testInfo.testResult];
    }
}
+(instancetype)cellWithTableView:(UITableView *)tableView{
    static NSString *cellId = @"testCell";
    TestInfoCell *cell = [tableView dequeueReusableCellWithIdentifier:cellId];
    if (cell == nil) {
        cell = [[TestInfoCell alloc] initWithStyle:UITableViewCellStyleDefault reuseIdentifier:cellId];
    }
    cell.accessoryType = UITableViewCellAccessoryNone;
    return cell;
}
- (void)setSelected:(BOOL)selected animated:(BOOL)animated {
    [super setSelected:selected animated:animated];

    // Configure the view for the selected state
}

@end
